package com.njitzx;

//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.http.HttpStatus;

//@ApiModel(value = "AjaxResult对象", description = "Ajax响应结果")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {

//    @ApiModelProperty(value = "状态码")
    private Integer status;

//    @ApiModelProperty(value = "响应消息")
    private String msg;
//
//    @ApiModelProperty(value = "返回数据")
    private Object data;

    public static Result success() {
        return new Result(HttpStatus.OK.value(), "success", null);
    }

    public static Result success(Object data) {
        return new Result(HttpStatus.OK.value(), "success", data);
    }

    public static Result success(String msg, Object data) {
        return new Result(HttpStatus.OK.value(), msg, data);
    }

    public static Result success(int status, Object data) {
        return new Result(status, "success", data);
    }

    public static Result success(int status, String msg) {
        return new Result(status, msg, null);
    }

    public static Result success(int status, String msg, Object data) {
        return new Result(status, msg, data);
    }

    public static Result error(String msg) {
        return new Result(HttpStatus.INTERNAL_SERVER_ERROR.value(), msg, null);
    }

    public static Result error(int status, String msg) {
        return new Result(status, msg, null);
    }
}
